/**
 * Created by kpradhan on 3/6/14.
 */
public class Board {
    private UserIO userIO;
    private Player playerOne;
    private Player playerTwo;
    private BoardFormatter boardFormatter;

    public Board(UserIO userIO, Player playerOne, Player playerTwo, BoardFormatter boardFormatter) {
        this.userIO = userIO;
        this.playerOne = playerOne;
        this.playerTwo = playerTwo;
        this.boardFormatter = boardFormatter;
    }

    public void drawBlankBoard() {
        userIO.print(boardFormatter.blankBoard());
    }

    public void prompt(Player player) {
        userIO.print("Please enter a number 0 through 8");
        String selection = userIO.getInput();
        redraw(selection, player.getLetter());
    }

    private void redraw(String selection, String letter) {
        String newBoard = boardFormatter.format(selection, letter);
        userIO.print(newBoard);
    }
}
